import { defineStore } from 'pinia';
import { getImSystemConfigApi } from '@/api/imSystem.js'

export default defineStore('configStore', {
	state: () => {
		return {
			webrtc: {}
		}
	},
	actions: {
		setConfig(config) {
			this.webrtc = config.webrtc;
		},
		loadConfig() {
			return new Promise((resolve, reject) => {
				getImSystemConfigApi().then(res => {
					console.log("系统配置", res.data)
					this.setConfig(res.data);
					resolve();
				}).catch((error) => {
					reject(error);
				});
			})
		}
	}
});